﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace HMS.Data
{
    public class MasterSerivce
    {
        //public Gender GetGenderById(int genderId)
        //{
        //    using (var dt = new HMSEntities())
        //    {
        //        return dt.Genders.Find(genderId);    
        //    }
            
        //}

        public AppointmentStatu GetApptStatus(int Id)
        {
            using (var dt = new HMSEntities())
            {
                return dt.AppointmentStatus.Find(Id);    
            }
            
        }
        public Doctor_Location GetLocationIdOfDoctor(int docLocId)
        {
            using (var dt = new HMSEntities())
            {
                return dt.Doctor_Location.Find(docLocId);
            }
        }

        public Doctor_Location GetDoctorLocationId(int DocId, int LocId)
        {
            using (var dt = new HMSEntities())
            {
                var docLoc = (Doctor_Location)dt.Doctor_Location.Where(x => x.Doc_Id == DocId && x.Loc_Id == LocId).ToList<Doctor_Location>().FirstOrDefault();
                //docLoc = (Doctor_Location)dt.Doctor_Location.Where(x => x.Doc_Id == DocId && x.Loc_Id == LocId).ToList<Doctor_Location>().Take(1);
                return docLoc;
            }
        }

        public Location GetLocationByLocId(int LocId)
        {
            using (var dt = new HMSEntities())
            {
                return dt.Locations.Where(x => x.Loc_Id == LocId).FirstOrDefault();
            }
        }
        
    }
}